// 微博视频数据服务
export const mockWeiboData = {
  // 视频列表数据
  videos: [
    {
      id: 'wb123456789',  // 微博视频ID
      mid: '4987654321',  // 微博特有的mid字段
      title: '微博热门视频合集',
      cover: 'https://picsum.photos/id/237/640/360',  // 使用直接图片URL
      videoUrl: 'https://aigc-files.bigmodel.cn/api/cogvideo/927c8f92-71ed-11f0-9a73-0e3f78bb420c_0.mp4',  // 使用直接视频URL
      embedUrl: 'https://weibo.com/tv/embed/1034:4987654321',
      author: {
        id: 'weibo_user123',
        name: '微博达人',
        avatar: '/src/assets/images/avatar/3.jpg',
        verified: true,
        followers: '126.5万'
      },
      stats: {
        views: '328.5万',
        likes: '18.3万',
        comments: '3245',
        reposts: '2.1万',
        collects: '4.5万'
      },
      tags: ['热门', '搞笑', '生活'],
      description: '微博热门视频精选，每天更新！#热门视频 #搞笑日常',
      duration: '1:32',
      publishTime: '2024-03-21 10:15:00',
      status: 'normal'
    },
    {
      id: 'wb987654321',
      mid: '4123456789',
      title: '科技前沿：最新AI技术展示',
      cover: 'https://picsum.photos/id/240/640/360',  // 更新为直接图片URL
      videoUrl: 'https://aigc-files.bigmodel.cn/api/cogvideo/927c8f92-71ed-11f0-9a73-0e3f78bb420c_3.mp4',  // 更新为直接视频URL
      embedUrl: 'https://weibo.com/tv/embed/1034:4123456789',
      author: {
        id: 'tech_guru',
        name: '科技前沿',
        avatar: '/src/assets/images/avatar/4.jpg',
        verified: true,
        followers: '256.8万'
      },
      stats: {
        views: '456.2万',
        likes: '23.7万',
        comments: '5689',
        reposts: '3.8万',
        collects: '6.2万'
      },
      tags: ['科技', 'AI', '前沿技术'],
      description: '最新AI技术展示，带你了解未来科技发展趋势！#人工智能 #科技',
      duration: '3:45',
      publishTime: '2024-03-20 16:40:00',
      status: 'normal'
    }
  ],

  // 获取视频列表
  getVideoList() {
    return new Promise((resolve) => {
      setTimeout(() => {
        resolve({
          list: this.videos,
          total: this.videos.length
        })
      }, 300)
    })
  },

  // 获取视频详情
  getVideoDetail(id) {
    return new Promise((resolve, reject) => {
      setTimeout(() => {
        const video = this.videos.find((v) => v.id === id)
        if (video) {
          resolve(video)
        } else {
          reject(new Error('视频不存在'))
        }
      }, 200)
    })
  },

  // 获取视频统计数据
  getVideoStats(id) {
    return new Promise((resolve) => {
      setTimeout(() => {
        const video = this.videos.find((v) => v.id === id)
        if (video) {
          // 模拟实时数据变化
          const randomIncrease = (num) => {
            const base = parseInt(num.replace(/[^\d]/g, ''))
            return base + Math.floor(Math.random() * 100)
          }

          resolve({
            ...video.stats,
            views: randomIncrease(video.stats.views),
            likes: randomIncrease(video.stats.likes),
            comments: randomIncrease(video.stats.comments)
          })
        } else {
          resolve({})
        }
      }, 200)
    })
  },

  // 获取视频播放URL
  getVideoUrl(video) {
    return video.embedUrl || video.videoUrl
  }
}